From 03ea863303f401e2d5fcda24f0dcdb2063ab7438 Mon Sep 17 00:00:00 2001 From: xftroxgpx Date: Tue, 18 Jul 2017 11:13:34 +0200 Subject: [PATCH] quote the binary name in the warning to avoid confusion when the warning happens inside a workspace, example: pwd is rustlearnage/rust_books/1_first_edition/closures/ and `cargo run` shows: warning: path `src/main.rs` was erroneously implicitly accepted for binary match, please set bin.path in Cargo.toml (note that 'match' is not quoted, so it's confusing) the 'match' project that it's referring to is in rustlearnage/rust_books/1_first_edition/match/ (note: Cargo.toml [workspace] is in rustlearnage/ ) --- src/cargo/util/toml/targets.rs | 2 +- tests/build.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cargo/util/toml/targets.rs b/src/cargo/util/toml/targets.rs index d7e6af08c..9cd5ed5ff 100644 --- a/src/cargo/util/toml/targets.rs +++ b/src/cargo/util/toml/targets.rs @@ -182,7 +182,7 @@ fn clean_bins(toml_bins: Option<&Vec>, .unwrap_or(&legacy_path); warnings.push(format!( - "path `{}` was erroneously implicitly accepted for binary {},\n\ + "path `{}` was erroneously implicitly accepted for binary `{}`,\n\ please set bin.path in Cargo.toml", short_path.display(), bin.name() )); diff --git a/tests/build.rs b/tests/build.rs index 8c7b0c59b..c94f5c56b 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -1402,7 +1402,7 @@ fn legacy_binary_paths_warinigs() { .file("src/main.rs", "fn main() {}"); assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr_contains("\ -[WARNING] path `src[/]main.rs` was erroneously implicitly accepted for binary bar, +[WARNING] path `src[/]main.rs` was erroneously implicitly accepted for binary `bar`, please set bin.path in Cargo.toml")); let mut p = project("world"); @@ -1419,7 +1419,7 @@ please set bin.path in Cargo.toml")); .file("src/bin/main.rs", "fn main() {}"); assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr_contains("\ -[WARNING] path `src[/]bin[/]main.rs` was erroneously implicitly accepted for binary bar, +[WARNING] path `src[/]bin[/]main.rs` was erroneously implicitly accepted for binary `bar`, please set bin.path in Cargo.toml")); let mut p = project("world"); @@ -1435,7 +1435,7 @@ please set bin.path in Cargo.toml")); .file("src/bar.rs", "fn main() {}"); assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr_contains("\ -[WARNING] path `src[/]bar.rs` was erroneously implicitly accepted for binary bar, +[WARNING] path `src[/]bar.rs` was erroneously implicitly accepted for binary `bar`, please set bin.path in Cargo.toml")); } -- 2.30.2